package cn.wolfcode.mp.domain;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.util.HashMap;

@Setter
@Getter
@ToString
@TableName("t_employee")
public class Employee {

    @TableId(value="id", type= IdType.AUTO)
    private Long id;
    private String name;
    private String username;
    private String password;
    private String email;
    private int age;
    private boolean admin;
    private Long deptId;

    @TableField(exist = false)
    private Department dept;

    public String getJson(){
        HashMap<String, Object> map = new HashMap<>();
        map.put("id",id);
        map.put("name",name);
        return JSON.toJSONString(map);
    }
}
